package com.mx.adapt.pager.indicator

import android.content.Context
import com.mx.adapt.R

/**
 * 圆角指示器
 */
open class MXRoundIndicator(private val selectWidthPercent: Float = 1f) : MXBaseIndicator() {
    /**
     * 获取Margin边距
     */
    override fun getGroupMargin(context: Context): Int {
        return context.resources.getDimensionPixelSize(R.dimen.mx_adapt_indicator_margin)
    }

    /**
     * 获取每个Item的宽高
     */
    override fun getNormalItemSize(context: Context): IntArray {
        val size = context.resources.getDimensionPixelSize(R.dimen.mx_adapt_indicator_size)
        return intArrayOf(size, size)
    }

    override fun getSelectItemSize(context: Context): IntArray {
        val size = context.resources.getDimensionPixelSize(R.dimen.mx_adapt_indicator_size)
        return intArrayOf((size * selectWidthPercent).toInt(), size)
    }

    /**
     * 获取Item的间距
     */
    override fun getItemMargin(context: Context): Int {
        return context.resources.getDimensionPixelSize(R.dimen.mx_adapt_divider_normal)
    }

    /**
     * 获取Item的背景图
     */
    override fun getItemBackgroundRes(): Int {
        return R.drawable.mx_banner_indicator_item_round_bg
    }
}